package com.bestcem.xm.ticket.service.dto.ticket;


import com.bestcem.xm.ticket.service.manager.record.param.TransferParam;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Objects;

/**
 * 关闭工单 service 入参
 *
 * @author XiaoYunSong <ys.xiao@idiaoyan.com>
 * @version v1.0
 * @date 2021/8/25 19:33
 */
@NoArgsConstructor
@AllArgsConstructor
@Data
public class CloseTicketDTO {

    /**
     * ticketId
     */
    private String ticketId;

    /**
     * orgId
     */
    private String orgId = "";

    /**
     * userId
     */
    private String userId = "";

    /**
     * userName
     */
    private String userName = "";

    /**
     * regionName
     */
    private String regionName = "";

    /**
     * superId
     */
    private String superId = "";

    /**
     * 工单关闭原因
     */
    private String reason = "";

    public static TransferParam toTransferParam(CloseTicketDTO closeTicketDTO) {
        if (Objects.isNull(closeTicketDTO)) {
            return null;
        }
        TransferParam transferParam = new TransferParam();
        transferParam.setTicketId(closeTicketDTO.getTicketId());
        transferParam.setOrgId(closeTicketDTO.getOrgId());
        transferParam.setUserId(closeTicketDTO.getUserId());
        transferParam.setUserName(closeTicketDTO.getUserName());
        transferParam.setRegionName(closeTicketDTO.getRegionName());
        transferParam.setReason(closeTicketDTO.getReason());
        return transferParam;
    }
}
